package com.village.friend.pay;



import java.util.Map;

public class ResultDto {

    /**
     * 交易成功返回
     *
     * @param resultMap
     * @return
     */
    public static <T> RespDto<T> appSuccess(T resultMap) {
        RespDto<T> respDto = new RespDto<>();
        respDto.setCode(AppEnum.RESP_SUCCESS.getEnumCode());
        respDto.setMsg(AppEnum.RESP_SUCCESS.getEnumMsg());
        respDto.setStatus(AppEnum.RESP_STATUS_SUCCESS.getEnumCode());
        respDto.setData(resultMap);
        return respDto;
    }

    public static RespDto appSuccess(Map<String, Object> resultMap) {
        RespDto respDto = new RespDto();
        respDto.setCode(AppEnum.RESP_SUCCESS.getEnumCode());
        respDto.setMsg(AppEnum.RESP_SUCCESS.getEnumMsg());
        respDto.setStatus(AppEnum.RESP_STATUS_SUCCESS.getEnumCode());
        respDto.setData(resultMap);
        return respDto;
    }

    public static RespDto appSuccess() {
        RespDto respDto = new RespDto();
        respDto.setCode(AppEnum.RESP_SUCCESS.getEnumCode());
        respDto.setMsg(AppEnum.RESP_SUCCESS.getEnumMsg());
        respDto.setStatus(AppEnum.RESP_STATUS_SUCCESS.getEnumCode());
        return respDto;
    }

    public static RespDto appFailed(String msg) {
        RespDto respDto = new RespDto();
        respDto.setCode(AppEnum.RESP_FAILD.getEnumCode());
        respDto.setMsg(msg);
        respDto.setStatus(AppEnum.RESP_STATUS_FAILD.getEnumCode());
        return respDto;
    }

    public static RespDto appFailed(String code, String msg) {
        RespDto respDto = new RespDto();
        respDto.setCode(code);
        respDto.setMsg(msg);
        respDto.setStatus(AppEnum.RESP_STATUS_FAILD.getEnumCode());
        return respDto;
    }


}
